<template>
	<div class="step1" :key="rateKey">
		<ul class="uls" style="border-bottom: 1px solid #dddddd; border-right: 1px solid #dddddd">
			<li class="lis">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.feeRateAlgorithm">
						<el-form slot="reference">
							<el-form-item label="管理费算法" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('feeRateAlgorithm', '管理费算法', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3">
					<el-select
						v-model="rateInfo.feeRateAlgorithm"
						placeholder="请选择"
						:disabled="isBaseDisabled"
						@change="changeFeeRateAlgorith"
						filterable
						clearable
					>
						<el-option value="" label="--请选择--"></el-option>
						<el-option
							v-for="(item, index) in productDictList.feeRateAlgorithm"
							:key="index + 'a'"
							:label="item.typeName"
							:value="item.typeCode"
						>
						</el-option>
					</el-select>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.feeRateAlgorithm">请选择管理费算法</div>
				</div>
			</li>

			<li class="lis">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.managementRate">
						<el-form slot="reference">
							<el-form-item label="" :required="!!rateInfo.feeRateAlgorithm && rateInfo.feeRateAlgorithm === '2'" class="slotlabel">
								<span slot="label">
									管理费率
									<span v-if="['6'].includes(dataType)">
										<span class="infoClass" v-if="feeRateCCompareRemak(manageRate[0].feeRateType, '', `管理费率`)">
											(未复核)
										</span>
									</span>
									<br />
									<span class="infoClass" v-if="rateInfo.feeRateAlgorithm === '1'">(若选择浮动管理费率，则填写基本管理费)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3" v-if="manageRate.length">
					<el-input v-model="manageRate[0].feeRate" @input="scale(manageRate[0], 'feeRate')" type="text" :disabled="isBaseDisabled">
						<el-select v-model="manageRate[0].feeRateUnit" slot="append" :disabled="isBaseDisabled">
							<el-option label="%" value="1"></el-option>
							<el-option label="元/笔" value="2"></el-option>
						</el-select>
					</el-input>
					<div
						class="blurmsg"
						v-if="isCheck && !!!manageRate[0].feeRate && !!rateInfo.feeRateAlgorithm && rateInfo.feeRateAlgorithm === '2'"
					>
						请输入管理费率
					</div>
				</div>
			</li>

			<li class="lis">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.managementRateRemark">
						<el-form slot="reference">
							<el-form-item label="" class="slotlabel">
								<span slot="label">
									管理费率备注
									<span v-if="['6'].includes(dataType)">
										<span class="infoClass" v-if="feeRateCCompareRemak(manageRate[0].feeRateType, '', `管理费率备注`)">
											(未复核)
										</span>
									</span>
									<br />
									<span class="infoClass" v-if="rateInfo.feeRateAlgorithm === '1'">(若选择浮动管理费率，则填写基本管理费备注)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3" v-if="manageRate.length">
					<el-input
						type="textarea"
						v-model="manageRate[0].remark"
						:disabled="isBaseDisabled"
						show-word-limit
						style="width: 100%"
						placeholder="最大字数为1000字"
					/>
				</div>
			</li>

			<li class="lis">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.custodyFeeAlgorithm">
						<el-form slot="reference">
							<el-form-item label="托管费算法" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('custodyFeeAlgorithm', '托管费算法', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3">
					<el-select v-model="rateInfo.custodyFeeAlgorithm" placeholder="请选择" :disabled="isBaseDisabled" filterable clearable>
						<el-option value="" label="--请选择--"></el-option>
						<el-option
							v-for="(item, index) in productDictList.custodyFeeAlgorithm"
							:key="index + 'a'"
							:label="item.typeName"
							:value="item.typeCode"
						>
						</el-option>
					</el-select>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.custodyFeeAlgorithm">请选择托管费算法</div>
				</div>
			</li>

			<li class="lis">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.escrowRate">
						<el-form slot="reference">
							<el-form-item
								label=""
								:required="!!rateInfo.custodyFeeAlgorithm && rateInfo.custodyFeeAlgorithm === '1'"
								class="slotlabel"
							>
								<span slot="label">
									托管费率
									<span v-if="['6'].includes(dataType)">
										<span class="infoClass" v-if="feeRateCCompareRemak(trusteeRate[0].feeRateType, '', `托管费率`)"
											>(未复核)</span
										>
									</span>
									<br />
									<span class="infoClass" v-if="rateInfo.custodyFeeAlgorithm === '3'">(若选择浮动托管费率，则填写基本托管费)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3" v-if="trusteeRate.length">
					<el-input v-model="trusteeRate[0].feeRate" @input="scale(trusteeRate[0], 'feeRate')" type="text" :disabled="isBaseDisabled">
						<el-select v-model="trusteeRate[0].feeRateUnit" slot="append" :disabled="isBaseDisabled">
							<el-option label="%" value="1"></el-option>
							<el-option label="元/笔" value="2"></el-option>
						</el-select>
					</el-input>
					<div
						class="blurmsg"
						v-if="isCheck && !!!trusteeRate[0].feeRate && !!rateInfo.custodyFeeAlgorithm && rateInfo.custodyFeeAlgorithm === '1'"
					>
						请输入托管费率
					</div>
				</div>
			</li>

			<li class="lis">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.escrowRateRemark">
						<el-form slot="reference">
							<el-form-item label="" class="slotlabel">
								<span slot="label">
									托管费率备注
									<span v-if="['6'].includes(dataType)">
										<span class="infoClass" v-if="feeRateCCompareRemak(trusteeRate[0].feeRateType, '', `托管费率备注`)"
											>(未复核)</span
										>
									</span>
									<br />
									<span class="infoClass" v-if="rateInfo.custodyFeeAlgorithm === '3'"
										>(若选择浮动托管费率，则填写基本托管费备注)</span
									>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3" v-if="trusteeRate.length">
					<el-input
						type="textarea"
						v-model="trusteeRate[0].remark"
						:disabled="isBaseDisabled"
						show-word-limit
						style="width: 100%"
						placeholder="最大字数为1000字"
					/>
				</div>
			</li>

			<template v-if="baseData.RateList.length > 0">
				<div v-for="(item, index) in baseData.RateList" :key="index + 'feilv1'" style="width: 100%">
					<li class="lis">
						<div class="div1">
							<el-popover
								placement="top-start"
								width="200"
								trigger="hover"
								:content="$store.getters.hoverPerty.rateInfo.salesServiceFeeAlgorithm"
							>
								<el-form slot="reference">
									<el-form-item :label="`${RateeTitle(item, 1)}销售服务费算法`" required>
										<span v-if="['6'].includes(dataType)">
											<span
												style="color: red"
												v-if="feeRateCCompareRemak('8', item.subFundType, `${checkTitle(item)}销售服务费算法`)"
												>(未复核)</span
											>
										</span>
									</el-form-item>
								</el-form>
							</el-popover>
						</div>
						<div class="div3">
							<el-select
								v-model="item.branchSalesSerivceRate[0].salesServiceFeeAlgorithm"
								placeholder="请选择"
								:disabled="isBaseDisabled"
								filterable
								clearable
								@change="saleChan(item)"
							>
								<el-option value="" label="--请选择--"></el-option>
								<el-option
									v-for="(item, index) in productDictList.salesServiceFeeAlgorithm"
									:key="index + 'a'"
									:label="item.typeName"
									:value="item.typeCode"
								>
								</el-option>
							</el-select>
							<div class="blurmsg" v-if="isCheck && !!!item.branchSalesSerivceRate[0].salesServiceFeeAlgorithm">
								请选择销售服务费算法
							</div>
						</div>
					</li>

					<li class="lis">
						<div class="div1">
							<el-popover
								placement="top-start"
								width="200"
								trigger="hover"
								:content="$store.getters.hoverPerty.rateInfo.salesServiceRate"
							>
								<el-form slot="reference">
									<el-form-item
										label=""
										:required="item.branchSalesSerivceRate[0].salesServiceFeeAlgorithm === '2'"
										class="slotlabel"
									>
										<span slot="label">
											{{ `${RateeTitle(item, 1)}销售服务费率` }}
											<span v-if="['6'].includes(dataType)">
												<span
													class="infoClass"
													v-if="feeRateCCompareRemak('8', item.subFundType, `${checkTitle(item)}销售服务费率`)"
													>(未复核)</span
												>
											</span>
											<br />
											<span
												class="infoClass"
												v-if="
													item &&
													item.branchSalesSerivceRate &&
													item.branchSalesSerivceRate.length &&
													item.branchSalesSerivceRate[0].salesServiceFeeAlgorithm === '4'
												"
												>(若选择浮动销售服务费率，则填写基本销售服务费)</span
											>
										</span>
									</el-form-item>
								</el-form>
							</el-popover>
						</div>
						<div class="div3" v-if="!!item.branchSalesSerivceRate">
							<el-input
								v-model="item.branchSalesSerivceRate[0].feeRate"
								@input="scale(item.branchSalesSerivceRate[0], 'feeRate')"
								:disabled="isBaseDisabled || item.branchSalesSerivceRate[0].salesServiceFeeAlgorithm === '1'"
							>
								<el-select v-model="item.branchSalesSerivceRate[0].feeRateUnit" slot="append" :disabled="isBaseDisabled">
									<el-option label="%" value="1"></el-option>
									<el-option label="元/笔" value="2"></el-option>
								</el-select>
							</el-input>
							<div
								class="blurmsg"
								v-if="
									isCheck &&
									!!!item.branchSalesSerivceRate[0].feeRate &&
									item.branchSalesSerivceRate[0].salesServiceFeeAlgorithm === '2'
								"
							>
								请输入销售服务费率
							</div>
						</div>
					</li>

					<li class="lis">
						<div class="div1">
							<el-popover
								placement="top-start"
								width="200"
								trigger="hover"
								:content="$store.getters.hoverPerty.rateInfo.salesServiceRateRemark"
							>
								<el-form slot="reference">
									<el-form-item label="" class="slotlabel">
										<span slot="label">
											{{ `${RateeTitle(item, 1)}销售服务费率备注` }}
											<span v-if="['6'].includes(dataType)">
												<span
													class="infoClass"
													v-if="feeRateCCompareRemak('8', item.subFundType, `${checkTitle(item)}销售服务费率备注`)"
													>(未复核)</span
												>
											</span>
											<br />
											<span
												class="infoClass"
												v-if="
													item &&
													item.branchSalesSerivceRate &&
													item.branchSalesSerivceRate.length &&
													item.branchSalesSerivceRate[0].salesServiceFeeAlgorithm === '4'
												"
												>(若选择浮动销售服务费率，则填写基本销售服务费备注)</span
											>
										</span>
									</el-form-item>
								</el-form>
							</el-popover>
						</div>
						<div class="div3" v-if="!!item.branchSalesSerivceRate">
							<el-input
								type="textarea"
								v-model="item.branchSalesSerivceRate[0].remark"
								:disabled="isBaseDisabled || item.branchSalesSerivceRate[0].salesServiceFeeAlgorithm === '1'"
								show-word-limit
								style="width: 100%"
								placeholder="最大字数为1000字"
							/>
						</div>
					</li>
				</div>
			</template>

			<li class="lis">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.isAchieveReward">
						<el-form slot="reference">
							<el-form-item label="是否提取业绩报酬" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('isAchieveReward', '是否提取业绩报酬', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3">
					<el-radio-group
						v-model="rateInfo.isAchieveReward"
						:disabled="isBaseDisabled"
						@change="clearChange(['rewardExplain', 'accrualDatum', 'accrualRatio', 'accrualPointTime'])"
					>
						<el-radio label="0">是</el-radio>
						<el-radio label="1">否</el-radio>
					</el-radio-group>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.isAchieveReward">请选择是否提取业绩报酬</div>
				</div>
			</li>

			<li class="lis" v-if="rateInfo.isAchieveReward === '0'">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.accrualPointTime">
						<el-form slot="reference">
							<el-form-item label="计提时点" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('accrualPointTime', '计提时点', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3">
					<el-checkbox-group v-model="timePoint" style="width: 100%" @change="focusUpdate">
						<el-checkbox :label="item.typeCode" :disabled="isBaseDisabled" v-for="(item, index) in checkLists" :key="index + 'check'">{{
							item.typeName
						}}</el-checkbox>
					</el-checkbox-group>
					<div class="blurmsg" v-if="isCheck && !timePoint.length">请选择计提时点</div>
				</div>
			</li>

			<li class="lis" v-if="rateInfo.isAchieveReward === '0'">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.rewardExplain">
						<el-form slot="reference">
							<el-form-item label="业绩报酬说明" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('rewardExplain', '业绩报酬说明', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3">
					<el-input
						type="textarea"
						@input="focusUpdate"
						v-model="rateInfo.rewardExplain"
						:disabled="isBaseDisabled"
						show-word-limit
						style="width: 100%"
					/>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.rewardExplain">请输入业绩报酬说明</div>
				</div>
			</li>

			<li class="lis" required v-if="rateInfo.isAchieveReward === '0'">
				<div class="div2">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.accrualDatum">
						<el-form slot="reference">
							<el-form-item label="计提基准" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('accrualDatum', '计提基准', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div2">
					<el-input v-model="rateInfo.accrualDatum" :disabled="isBaseDisabled" @input="focusUpdate"></el-input>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.accrualDatum">请输入计提基准</div>
				</div>
				<div class="div2">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.accrualRatio">
						<el-form slot="reference">
							<el-form-item label="计提比例" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('accrualRatio', '计提比例', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div2">
					<el-input v-model="rateInfo.accrualRatio" :disabled="isBaseDisabled" @input="focusUpdate"></el-input>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.accrualRatio">请输入计提比例</div>
				</div>
			</li>
		</ul>

		<div v-if="baseData.RateList.length">
			<div v-for="(item, index) in baseData.RateList" :key="index" class="tableParnode">
				<div style="width: 100%" :class="!['1', ''].includes(item.subFundType) ? 'widthClass' : ''">
					<h2 style="margin-top: 40px">{{ RateeTitle(item) }}认购费率</h2>
					<ul class="uls tabuls">
						<li class="list1" v-if="!!item.subRateList" :class="!['1', ''].includes(item.subFundType) ? 'listClass' : ''">
							<div class="list1item">
								<el-popover
									placement="top-start"
									width="200"
									trigger="hover"
									:content="$store.getters.hoverPerty.rateInfo.ordinarySubscription"
								>
									<span slot="reference">
										{{ RateeTitle(item) }}普通认购
										<span style="color: rgb(0, 128, 0)"> [ E 表示正无穷 ]</span>
										<span style="color: red; margin-left: 10px">{{ item.subRateMsg }}</span>
										<span
											style="color: red"
											v-if="
												['6'].includes(dataType) &&
												feeRateCCompare(item.subRateList[0].feeRateType, item.subFundType, `${checkTitle(item)}普通认购`)
											"
											>(未复核)</span
										>
									</span>
								</el-popover>
							</div>
							<div class="list1item">
								<div style="border-left: none" class="list1itemChild">认购金额（含认购费）</div>
								<div class="list1itemChild">认购金额（含认购费）</div>
								<div class="list1itemChild">认购金额（含认购费）</div>
								<div class="list1itemChild">认购费率</div>
							</div>
							<div class="list1item" v-for="(items, indexs) in 4" :key="indexs + 'as4'">
								<div style="border-left: none" class="list1itemChild">
									<el-input
										v-model="item.subRateList[indexs].startSection"
										disabled
										@input="refresh(item.subRateList, 'subRateMsg', item)"
									/>
								</div>
								<div class="list1itemChild">≤ 金额（万元）＜</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.subRateList[indexs].endSection"
										:disabled="isBaseDisabled"
										@input="refresh(item.subRateList, 'subRateMsg', item)"
									/>
								</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.subRateList[indexs].feeRate"
										:disabled="isBaseDisabled"
										@input="refresh(item.subRateList, 'subRateMsg', item)"
									>
										<el-select
											v-model="item.subRateList[indexs].feeRateUnit"
											slot="append"
											:disabled="isBaseDisabled"
											@input="refresh(item.subRateList, 'subRateMsg', item)"
										>
											<el-option label="%" value="1"></el-option>
											<el-option label="元/笔" value="2"></el-option>
										</el-select>
									</el-input>
								</div>
							</div>
						</li>
						<li class="list1" v-if="!!item.subCntList">
							<div class="list1item">
								<el-popover
									placement="top-start"
									width="200"
									trigger="hover"
									:content="$store.getters.hoverPerty.rateInfo.pensionCustomers"
								>
									<span slot="reference">
										{{ RateeTitle(item) }}通过直销中心认购的养老金客户
										<span style="color: rgb(0, 128, 0)">[ E 表示正无穷 ]</span>
										<span style="color: red; margin-left: 10px">{{ item.subCntMsg }}</span>
										<span
											style="color: red"
											v-if="
												['6'].includes(dataType) &&
												feeRateCCompare(
													item.subCntList[0].feeRateType,
													item.subFundType,
													`${checkTitle(item)}通过直销中心认购的养老金客户`
												)
											"
											>(未复核)</span
										>
									</span>
								</el-popover>
							</div>
							<div class="list1item">
								<div style="border-left: none" class="list1itemChild">认购金额（含认购费）</div>
								<div class="list1itemChild">认购金额（含认购费）</div>
								<div class="list1itemChild">认购金额（含认购费）</div>
								<div class="list1itemChild">认购费率</div>
							</div>
							<div class="list1item" v-for="(items, indexs) in 4" :key="indexs + 'as7'">
								<div style="border-left: none" class="list1itemChild">
									<el-input
										v-model="item.subCntList[indexs].startSection"
										disabled
										@input="refresh(item.subCntList, 'subCntMsg', item)"
									/>
								</div>
								<div class="list1itemChild">≤ 金额（万元）＜</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.subCntList[indexs].endSection"
										:disabled="isBaseDisabled"
										@input="refresh(item.subCntList, 'subCntMsg', item)"
									/>
								</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.subCntList[indexs].feeRate"
										:disabled="isBaseDisabled"
										@input="refresh(item.subCntList, 'subCntMsg', item)"
									>
										<el-select
											v-model="item.subCntList[indexs].feeRateUnit"
											slot="append"
											:disabled="isBaseDisabled"
											@input="refresh(item.subCntList, 'subCntMsg', item)"
										>
											<el-option label="%" value="1"></el-option>
											<el-option label="元/笔" value="2"></el-option>
										</el-select>
									</el-input>
								</div>
							</div>
						</li>
					</ul>
				</div>

				<div style="width: 100%" :class="!['1', ''].includes(item.subFundType) ? 'widthClass' : ''">
					<h2 style="margin-top: 40px">
						{{ RateeTitle(item) }}前端-申购费率
						<el-checkbox
							style="color: #409eff; font-weight: 600"
							v-model="item.rearRndRatee"
							@click="item.rearRndRatee === !item.rearRndRatee"
							>{{ isBaseDisabled ? '查看' : '编辑' }}后端-普通申购费率</el-checkbox
						>
					</h2>
					<ul class="uls tabuls">
						<li class="list1" v-if="!!item.applyRateList" :class="!['1', ''].includes(item.subFundType) ? 'listClass' : ''">
							<div class="list1item">
								<el-popover
									placement="top-start"
									width="200"
									trigger="hover"
									:content="$store.getters.hoverPerty.rateInfo.generalSubscription"
								>
									<span slot="reference">
										{{ RateeTitle(item) }}前端-普通申购
										<span style="color: rgb(0, 128, 0)">[ E 表示正无穷 ]</span>
										<span style="color: red; margin-left: 10px">{{ item.applyRateMsg }}</span>
										<span
											style="color: red"
											v-if="
												['6'].includes(dataType) &&
												feeRateCCompare(
													item.applyRateList[0].feeRateType,
													item.subFundType,
													`${checkTitle(item)}前端-普通申购`
												)
											"
											>(未复核)</span
										>
									</span>
								</el-popover>
							</div>
							<div class="list1item">
								<div style="border-left: none" class="list1itemChild">申购金额</div>
								<div class="list1itemChild">申购金额</div>
								<div class="list1itemChild">申购金额</div>
								<div class="list1itemChild">申购费率</div>
							</div>
							<div class="list1item" v-for="(items, indexs) in 4" :key="indexs + 'as5'">
								<div style="border-left: none" class="list1itemChild">
									<el-input
										v-model="item.applyRateList[indexs].startSection"
										disabled
										@input="refresh(item.applyRateList, 'applyRateMsg', item)"
									/>
								</div>
								<div class="list1itemChild">≤ 金额（万元）＜</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.applyRateList[indexs].endSection"
										:disabled="isBaseDisabled"
										@input="refresh(item.applyRateList, 'applyRateMsg', item)"
									/>
								</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.applyRateList[indexs].feeRate"
										:disabled="isBaseDisabled"
										@input="refresh(item.applyRateList, 'applyRateMsg', item)"
									>
										<el-select
											v-model="item.applyRateList[indexs].feeRateUnit"
											slot="append"
											:disabled="isBaseDisabled"
											@input="refresh(item.applyRateList, 'applyRateMsg', item)"
										>
											<el-option label="%" value="1"></el-option>
											<el-option label="元/笔" value="2"></el-option>
										</el-select>
									</el-input>
								</div>
							</div>
						</li>
						<li class="list1" v-if="!!item.applyCntList">
							<div class="list1item">
								<el-popover
									placement="top-start"
									width="200"
									trigger="hover"
									:content="$store.getters.hoverPerty.rateInfo.subscriptionCustomers"
								>
									<span slot="reference">
										{{ RateeTitle(item) }}前端-通过直销中心申购的养老金客户
										<span style="color: rgb(0, 128, 0)">[ E 表示正无穷 ]</span>
										<span style="color: red; margin-left: 10px">{{ item.applyCntMsg }}</span>
										<span
											style="color: red"
											v-if="
												['6'].includes(dataType) &&
												feeRateCCompare(
													item.applyCntList[0].feeRateType,
													item.subFundType,
													`${checkTitle(item)}前端-通过直销中心申购的养老金客户`
												)
											"
											>(未复核)</span
										>
									</span>
								</el-popover>
							</div>
							<div class="list1item">
								<div style="border-left: none" class="list1itemChild">申购金额</div>
								<div class="list1itemChild">申购金额</div>
								<div class="list1itemChild">申购金额</div>
								<div class="list1itemChild">申购费率</div>
							</div>
							<div class="list1item" v-for="(items, indexs) in 4" :key="indexs + 'as8'">
								<div style="border-left: none" class="list1itemChild">
									<el-input
										v-model="item.applyCntList[indexs].startSection"
										disabled
										@input="refresh(item.applyCntList, 'applyCntMsg', item)"
									/>
								</div>
								<div class="list1itemChild">≤ 金额（万元）＜</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.applyCntList[indexs].endSection"
										:disabled="isBaseDisabled"
										@input="refresh(item.applyCntList, 'applyCntMsg', item)"
									/>
								</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.applyCntList[indexs].feeRate"
										:disabled="isBaseDisabled"
										@input="refresh(item.applyCntList, 'applyCntMsg', item)"
									>
										<el-select
											v-model="item.applyCntList[indexs].feeRateUnit"
											slot="append"
											:disabled="isBaseDisabled"
											@input="refresh(item.applyCntList, 'applyCntMsg', item)"
										>
											<el-option label="%" value="1"></el-option>
											<el-option label="元/笔" value="2"></el-option>
										</el-select>
									</el-input>
								</div>
							</div>
						</li>
					</ul>
				</div>
				<span v-if="['6'].includes(dataType)" style="width: 0; height: 0">
					<span v-if="!!item.rearRndApplyRateList && Array.isArray(item.rearRndApplyRateList) && item.rearRndApplyRateList.length">
						{{
							feeRateCCompare(item.rearRndApplyRateList[0].feeRateType, item.subFundType, `${checkTitle(item)}后端-普通申购`) ? '' : ''
						}}
					</span>
					<span v-if="!!item.rearRndApplyCntList && Array.isArray(item.rearRndApplyCntList) && item.rearRndApplyCntList.length">
						{{
							feeRateCCompare(
								item.rearRndApplyCntList[0].feeRateType,
								item.subFundType,
								`${checkTitle(item)}后端-通过直销中心申购的养老金客户`
							)
								? ''
								: ''
						}}
					</span>
				</span>
				<div v-if="item.rearRndRatee" style="width: 100%" :class="!['1', ''].includes(item.subFundType) ? 'widthClass' : ''">
					<h2 style="margin-top: 40px">{{ RateeTitle(item) }}后端-申购费率</h2>
					<ul class="uls tabuls">
						<li
							class="list1"
							v-if="!!item.rearRndApplyRateList && Array.isArray(item.rearRndApplyRateList) && item.rearRndApplyRateList.length"
							:class="!['1', ''].includes(item.subFundType) ? 'listClass' : ''"
						>
							<div class="list1item">
								<el-popover
									placement="top-start"
									width="200"
									trigger="hover"
									:content="$store.getters.hoverPerty.rateInfo.obEndSubscription"
								>
									<span slot="reference">
										{{ RateeTitle(item) }}后端-普通申购
										<span style="color: rgb(0, 128, 0)">[ E 表示正无穷 ]</span>
										<span style="color: red; margin-left: 10px">{{ item.rearRndApplyRateMsg }}</span>
										<span
											style="color: red"
											v-if="
												['6'].includes(dataType) &&
												feeRateCCompare(
													item.rearRndApplyRateList[0].feeRateType,
													item.subFundType,
													`${checkTitle(item)}后端-普通申购`
												)
											"
											>(未复核)</span
										>
									</span>
								</el-popover>
							</div>
							<div class="list1item">
								<div style="border-left: none" class="list1itemChild">持有期限</div>
								<div class="list1itemChild">持有期限</div>
								<div class="list1itemChild">持有期限</div>
								<div class="list1itemChild">申购费率</div>
							</div>
							<div class="list1item" v-for="(items, indexs) in 4" :key="indexs + 'as5'">
								<div style="border-left: none" class="list1itemChild">
									<el-input
										v-model="item.rearRndApplyRateList[indexs].startSection"
										:disabled="isBaseDisabled || indexs > 0"
										@input="refresh(item.rearRndApplyRateList, 'rearRndApplyRateMsg', item)"
									/>
								</div>
								<div class="list1itemChild">≤ 日期 ＜</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.rearRndApplyRateList[indexs].endSection"
										:disabled="isBaseDisabled"
										@input="refresh(item.rearRndApplyRateList, 'rearRndApplyRateMsg', item)"
									/>
								</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.rearRndApplyRateList[indexs].feeRate"
										:disabled="isBaseDisabled"
										@input="refresh(item.rearRndApplyRateList, 'rearRndApplyRateMsg', item)"
									>
										<el-select
											v-model="item.rearRndApplyRateList[indexs].feeRateUnit"
											slot="append"
											:disabled="isBaseDisabled"
											@input="refresh(item.rearRndApplyRateList, 'rearRndApplyRateMsg', item)"
										>
											<el-option label="%" value="1"></el-option>
											<el-option label="元/笔" value="2"></el-option>
										</el-select>
									</el-input>
								</div>
							</div>
						</li>
						<li
							class="list1"
							v-if="!!item.rearRndApplyCntList && Array.isArray(item.rearRndApplyCntList) && item.rearRndApplyCntList.length"
						>
							<div class="list1item">
								<el-popover
									placement="top-start"
									width="200"
									trigger="hover"
									:content="$store.getters.hoverPerty.rateInfo.bendPensionS"
								>
									<span slot="reference">
										{{ RateeTitle(item) }}后端-通过直销中心申购的养老金客户
										<span style="color: rgb(0, 128, 0)">[ E 表示正无穷 ]</span>
										<span style="color: red; margin-left: 10px">{{ item.rearRndApplyCntMsg }}</span>
										<span
											style="color: red"
											v-if="
												['6'].includes(dataType) &&
												feeRateCCompare(
													item.rearRndApplyCntList[0].feeRateType,
													item.subFundType,
													`${checkTitle(item)}后端-通过直销中心申购的养老金客户`
												)
											"
											>(未复核)</span
										>
									</span>
								</el-popover>
							</div>
							<div class="list1item">
								<div style="border-left: none" class="list1itemChild">持有期限</div>
								<div class="list1itemChild">持有期限</div>
								<div class="list1itemChild">持有期限</div>
								<div class="list1itemChild">申购费率</div>
							</div>
							<div class="list1item" v-for="(items, indexs) in 4" :key="indexs + 'as8'">
								<div style="border-left: none" class="list1itemChild">
									<el-input
										v-model="item.rearRndApplyCntList[indexs].startSection"
										:disabled="isBaseDisabled || indexs > 0"
										@input="refresh(item.rearRndApplyCntList, 'rearRndApplyCntMsg', item)"
									/>
								</div>
								<div class="list1itemChild">≤ 日期 ＜</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.rearRndApplyCntList[indexs].endSection"
										:disabled="isBaseDisabled"
										@input="refresh(item.rearRndApplyCntList, 'rearRndApplyCntMsg', item)"
									/>
								</div>
								<div class="list1itemChild">
									<el-input
										v-model="item.rearRndApplyCntList[indexs].feeRate"
										:disabled="isBaseDisabled"
										@input="refresh(item.rearRndApplyCntList, 'rearRndApplyCntMsg', item)"
									>
										<el-select
											v-model="item.rearRndApplyCntList[indexs].feeRateUnit"
											slot="append"
											:disabled="isBaseDisabled"
											@input="refresh(item.rearRndApplyCntList, 'rearRndApplyCntMsg', item)"
										>
											<el-option label="%" value="1"></el-option>
											<el-option label="元/笔" value="2"></el-option>
										</el-select>
									</el-input>
								</div>
							</div>
						</li>
					</ul>
				</div>

				<div style="width: 100%">
					<h2 style="margin-top: 40px">{{ RateeTitle(item) }}赎回费率</h2>
					<ul class="uls tabuls">
						<li class="list1" v-if="!!item.ransomRateList">
							<div class="list1item">
								<el-popover
									placement="top-start"
									width="200"
									trigger="hover"
									:content="$store.getters.hoverPerty.rateInfo.ordinaryRedemption"
								>
									<span slot="reference">
										{{ RateeTitle(item) }}普通赎回
										<span style="color: rgb(0, 128, 0)">[ E 表示正无穷 ]</span>
										<span style="color: red; margin-left: 10px">{{ item.ransomRateMsg }}</span>
										<span
											style="color: red"
											v-if="
												['6'].includes(dataType) &&
												feeRateCCompare(item.ransomRateList[0].feeRateType, item.subFundType, `${checkTitle(item)}普通赎回`)
											"
											>(未复核)</span
										>
									</span>
								</el-popover>
							</div>
							<div class="list1item">
								<div style="border-left: none" class="list1itemChildend">持有期限</div>
								<div class="list1itemChildend">持有期限</div>
								<div class="list1itemChildend">持有期限</div>
								<div class="list1itemChildend">赎回费率</div>
								<div class="list1itemChildend">归基金资产比例</div>
							</div>
							<div class="list1item" v-for="(items, indexs) in 6" :key="indexs + 'as6'">
								<div style="border-left: none" class="list1itemChildend">
									<el-input
										v-model="item.ransomRateList[indexs].startSection"
										:disabled="isBaseDisabled || indexs > 0"
										@input="refresh(item.ransomRateList, 'ransomRateMsg', item)"
									/>
								</div>
								<div class="list1itemChildend">≤ 日期 ＜</div>
								<div class="list1itemChildend">
									<el-input
										v-model="item.ransomRateList[indexs].endSection"
										:disabled="isBaseDisabled"
										@input="refresh(item.ransomRateList, 'ransomRateMsg', item)"
									/>
								</div>
								<div class="list1itemChildend">
									<el-input
										v-model="item.ransomRateList[indexs].feeRate"
										:disabled="isBaseDisabled"
										@input="refresh(item.ransomRateList, 'ransomRateMsg', item)"
									>
										<el-select
											v-model="item.ransomRateList[indexs].feeRateUnit"
											slot="append"
											:disabled="isBaseDisabled"
											@input="refresh(item.ransomRateList, 'ransomRateMsg', item)"
										>
											<el-option label="%" value="1"></el-option>
											<el-option label="元/笔" value="2"></el-option>
										</el-select>
									</el-input>
								</div>
								<div class="list1itemChildend">
									<el-input
										v-model="item.ransomRateList[indexs].belongFundRatio"
										:disabled="isBaseDisabled"
										@input="refresh(item.ransomRateList, 'ransomRateMsg', item)"
									>
										<el-select
											v-model="item.ransomRateList[indexs].belongFundRatioUnit"
											slot="append"
											:disabled="isBaseDisabled"
											@input="refresh(item.ransomRateList, 'ransomRateMsg', item)"
										>
											<el-option label="%" value="1"></el-option>
										</el-select>
									</el-input>
								</div>
							</div>
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
import { saveRate } from '@/api/productApi/infoMain'
import { getEnum } from '@/api/productApi/file'
import { publicCompare, feeRateCCompare, feeRateCCompareRemak } from '@/views/infoMain/publicList/components/dataCheck'
import { rateReview } from '@/views/infoMain/publicList/components/dataReview'
import { CompletionUpdate, initComple, mergeRate, jsonArray, RateVerification, valueCheckByRule } from './rateInfo'
import { digitalInput } from '@/utils/DigitalInput'
import { rateInfo } from '../../default'
export default {
	props: {
		setpFunc: {
			type: Function,
			default: Function
		},
		fundSysCode: {
			type: String,
			default: ''
		},
		dataType: {
			type: String,
			default: ''
		},
		haveYouWalked: {
			type: Object,
			default: Object
		}
	},
	data() {
		return {
			publicCompare,
			feeRateCCompare,
			feeRateCCompareRemak,
			rateInfo: {
				deferRaiseDate: false,
				isAchieveReward: '',
				custodyFeeAlgorithm: ''
			},
			productDictList: [], // 字典列表
			manageRate: [{ feeRateUnit: '1', feeRate: '', feeRateType: '9', feeRateId: 1, remark: '' }], // 管理费率
			trusteeRate: [{ feeRateUnit: '1', feeRate: '', feeRateType: '7', feeRateId: 1, remark: '' }], // 托管费率
			timePoint: [], // 计时提点
			isBaseDisabled: false,
			isCheck: false,
			rateKey: 1,
			baseData: {
				RateList: []
			},
			checkLists: [
				{ typeCode: '1', typeName: '不提取' },
				{ typeCode: '2', typeName: '资产管理计划投资者赎回时' },
				{ typeCode: '3', typeName: '资产管理计划分红时计提' },
				{ typeCode: '4', typeName: '资产管理计划固定开放日计提' },
				{ typeCode: '5', typeName: '资产管理计划临时开放日计提' },
				{ typeCode: '6', typeName: '资产管理计划到期计提' },
				{ typeCode: '7', typeName: '其他计提时点' }
			],
			fundType: []
		}
	},

	mounted() {
		this.getProductDictList()
	},
	methods: {
		focusUpdate(property) {
			this.$forceUpdate()
		},

		defaultValue() {
			// 当非查看状态时，赋值默认值
			setTimeout(() => {
				if ((this.dataType === '1' || this.dataType === '') && !this.haveYouWalked.rateMode) {
					rateInfo.forEach(item => {
						if (!this.rateInfo[item.key]) {
							this.$set(this.rateInfo, item.key, item.value)
						}
					})
				}
			})
		},

		// 重新申请将数据集中在store
		updateStoreData() {
			this.rateInfo.accrualPointTime = [...this.timePoint].toString()
			this.$store.state.fundStep.pucliktTotalData.productFundApply.rateInfo = this.rateInfo
			this.$store.state.fundStep.pucliktTotalData.productFundApply.rateInfo.feeRateInfoList = this.faReeHlep()
		},

		// 完善信息切换步骤时保存切换前页面数据
		async switchingSteps() {
			this.rateInfo.accrualPointTime = [...this.timePoint].toString()
			let msgFlag = true
			this.baseData.RateList.forEach(item => {
				if (
					!!item.subRateMsg ||
					!!item.subCntMsg ||
					!!item.applyRateMsg ||
					!!item.rearRndApplyRateMsg ||
					!!item.applyCntMsg ||
					!!item.rearRndApplyCntMsg ||
					!!item.ransomRateMsg
				) {
					msgFlag = false
				}
			})
			if (msgFlag) {
				const rateInfo = this.returnSaveData()
				await saveRate(rateInfo).then(res => {
					if (res.msgCode === 'Y') {
						this.$emit('setpFunc', '1', this.fundSysCode, '', 1)
					}
				})
				return true
			} else {
				this.$message({ message: '费率列表填写不满足条件,请修正!', type: 'error' })
			}
			return false
		},

		ValidationRequired() {
            this.rateInfo.accrualPointTime = [...this.timePoint].toString()
			this.rateInfo.feeRateInfoList = this.faReeHlep()
			const baseField = rateReview(this.rateInfo)
			let msgFlag = true
			this.baseData.RateList.forEach(item => {
				if (
					!!item.subRateMsg ||
					!!item.subCntMsg ||
					!!item.applyRateMsg ||
					!!item.rearRndApplyRateMsg ||
					!!item.applyCntMsg ||
					!!item.rearRndApplyCntMsg ||
					!!item.ransomRateMsg
				) {
					msgFlag = false
				}
			})
			if (!msgFlag) {
				this.$message({ message: '费率验证非法，请重新确认', type: 'error' })
				return {}
			}
			return baseField
		},

		// 新增:【保存】和【下一步】
		startDown(type) {
			this.rateInfo.accrualPointTime = [...this.timePoint].toString()
			let msgFlag = true
			this.baseData.RateList.forEach(item => {
				if (
					!!item.subRateMsg ||
					!!item.subCntMsg ||
					!!item.applyRateMsg ||
					!!item.rearRndApplyRateMsg ||
					!!item.applyCntMsg ||
					!!item.rearRndApplyCntMsg ||
					!!item.ransomRateMsg
				) {
					msgFlag = false
				}
			})
			if (msgFlag) {
				const rateInfo = this.returnSaveData()
				this.isCheck = true
				this.CustomtextComfirm(() => {
					saveRate(rateInfo).then(res => {
						if (res.msgCode === 'Y') {
							if (type === '下一步') {
								this.$emit('setpFunc', '1', this.fundSysCode, '', 0)
							} else {
								this.$emit('setpFunc', '1', this.fundSysCode, '', 1)
							}
							this.$message({ type: 'success', message: res.msg })
						}
					})
				}, `${!rateReview(this.rateInfo).length ? '此操作将永久提交已编辑数据，是否继续' : `必填项 “ ${rateReview(this.rateInfo).join('、')} ” 未填写，是否确认提交`}？`)
			} else {
				this.$message({ message: '费率列表填写不满足条件,请修改后提交!', type: 'error' })
			}
		},

		returnSaveData() {
			const params = {}
			params.productFundApply = {}
			params.productFundApply.rateInfo = this.rateInfo
			params.fundRaiseType = '1'
			params.fundSysCode = this.fundSysCode
			params.productFundApply.rateInfo.feeRateInfoList = this.faReeHlep()
			return params
		},

		isBaseDisabledCom(data, msgShow) {
			this.isBaseDisabled = data
			this.isCheck = msgShow
		},

		resetRate(num, list) {
			// num:1 是否单独份额发生变化  num:2 下属基金列表发生变化  list下属基金
			if (num === 1) {
				this.$set(this.baseData, 'RateList', [])
				const obj = CompletionUpdate('', '')
				this.baseData.RateList.push(obj)
			} else if (num === 2) {
				const code = []
				list.forEach(item => {
					code.push(item.subFundType)
				})
				// 去掉已经切换下属基金类型或者已经删除下属基金的费率
				this.baseData.RateList = this.baseData.RateList.filter(item => code.includes(item.subFundType))
				list.forEach(item => {
					// 增加新增的下属基金或者重新初始化已经改变下属基金类型的费率
					if (!this.baseData.RateList.some(obj => obj.subFundType === item.subFundType)) {
						this.baseData.RateList.push(CompletionUpdate(item, item.subFundType))
					}
				})
			}
		},

		edit(res) {
			// 初始化费率列表
			if (!res) {
				return
			}
			this.defaultValue()
			// 费率数据回显
			const data = jsonArray(res.data)
			if (data.body.productFundInfo) {
				if (data.body.productFundInfo.baseInfo) {
					this.baseData = initComple(jsonArray(data.body.productFundInfo), this)
				}
			}
			if (!!data.body.productFundApply && res.data.body.dataStatus !== '1') {
				if (data.body.productFundApply.baseInfo) {
					this.baseData = initComple(jsonArray(data.body.productFundApply), this)
				}
			}
		},

		// 费率合并
		faReeHlep() {
			const list = jsonArray(mergeRate(this))
			return list
		},

		// 查询字典列表
		getProductDictList() {
			getEnum(['feeRateAlgorithm', 'custodyFeeAlgorithm', 'salesServiceFeeAlgorithm']).then(res => {
				if (res.msgCode === 'Y') {
					this.productDictList = res.data.body
				}
			})
			this.fundType = jsonArray(this.$store.state.fundStep.subordinateFund)
		},

		refresh(list, showMsg, obj) {
			// 费率验证
			valueCheckByRule(list, showMsg)
			RateVerification(list, showMsg, obj)
		},

		clearChange(list) {
			// 清除联动字段
			this.timePoint = []
			list.forEach(key => {
				this.rateInfo[key] = ''
			})
		},

		changeFeeRateAlgorith() {
			if (['1', '3', '5', '7'].includes(this.dataType)) {
				if (this.rateInfo.feeRateAlgorithm === '1') {
					this.rateInfo.isAchieveReward = '0'
				} else if (this.rateInfo.feeRateAlgorithm === '0') {
					this.clearChange(['rewardExplain', 'accrualRatio', 'accrualDatum', 'accrualPointTime', 'isAchieveReward'])
				}
			}
		},

		scale(obj, property) {
			// 数字验证
			if (obj[property]) {
				obj[property] = digitalInput(obj[property])
			}
		},

		saleChan(item) {
			if (item.branchSalesSerivceRate[0].salesServiceFeeAlgorithm === '1') {
				item.branchSalesSerivceRate[0].feeRate = ''
				item.branchSalesSerivceRate[0].remark = ''
			}
		},

		RateeTitle(obj, num) {
			// 费率展示标题
			let msg = ''
			if (obj.SubordinateFunds) {
				const item = this.fundType.find(item => item.typeCode === obj.subFundType)
				if (num) {
					msg = `${item.typeName}-${obj.fundCode}-`
				} else {
					msg = `${item.typeName}-${obj.fundCode}-${obj.fundGradFullName}-`
				}
			}
			return msg
		},

		checkTitle(obj) {
			// 费率复核标题
			let msg = ''
			if (obj.SubordinateFunds) {
				const item = this.fundType.find(item => item.typeCode === obj.subFundType)
				msg = `${item.typeName}-${obj.fundCode}-`
			}
			return msg
		},

		getData() {
			// 当切换到费率信息时，使用全局数据联动本页面
			this.baseData = initComple(jsonArray(this.$store.state.fundStep.pucliktTotalData.productFundApply), this)
		}
	}
}
</script>
<style lang="scss" scoped src='./index.scss'></style>
